<?php
    class m
    {
        public static function r ($u) 
        {
            header('Location: '.$u);
            exit;
        }

        public static function version()
        {
            if ( is_file( dirname(  dirname(dirname(__FILE__)) ).'/'.'version.txt' ) )
            {
                $_version = file_get_contents ( dirname ( dirname( dirname(__FILE__)  )).'/'.'version.txt' );
                $_var_array = explode('/', $_version);
                //ревизия
                $_rev = $_var_array[2];
                //версия
                $_version = $_var_array[1];;
            }
            else
            {
			    echo 'no';
                $_version = '3.0.0';
            }

            return $_version; 
        }

        //m::prepare_input
        public static function prepare_input ($string)
        {
            if (is_string($string)) 
            {
                return trim( stripslashes( $string ) );
            } 
            elseif (is_array($string)) 
            {
                reset($string);
                while (list($key, $value) = each($string)) 
                {
                    $string[$key] = self::prepare_input($value);
                }
                return $string;
            } 
            else 
            {
                return $string;
            }
        }

        public static function clean($name) 
        {
            $replace_param='/[^a-zA-Zа-яА-Я0-9]/';
            $cyrillic = array("ж", "ё", "й","ю", "ь","ч", "щ", "ц","у","к","е","н","г","ш", "з","х","ъ","ф","ы","в","а","п","р","о","л","д","э","я","с","м","и","т","б","Ё","Й","Ю","Ч","Ь","Щ","Ц","У","К","Е","Н","Г","Ш","З","Х","Ъ","Ф","Ы","В","А","П","Р","О","Л","Д","Ж","Э","Я","С","М","И","Т","Б");
            $translit = array("zh","yo","i","yu","","ch","sh","c","u","k","e","n","g","sh","z","h","",  "f",  "y",  "v",  "a",  "p",  "r",  "o",  "l",  "d",  "ye", "ya", "s",  "m",  "i",  "t",  "b",  "yo", "I",  "YU", "CH", "",  "SH", "C",  "U",  "K",  "E",  "N",  "G",  "SH", "Z",  "H",  "",  "F",  "Y",  "V",  "A",  "P",  "R",  "O",  "L",  "D",  "Zh", "Ye", "Ya", "S",  "M",  "I",  "T",  "B");
            $name = str_replace($cyrillic, $translit, $name);    
            $name = preg_replace($replace_param,'-',$name);    
            return $name;
        }


    }


    function os_cleanName($name) 
    {
        return m::clean($name);
    }


?>
